﻿"""Auth-related request/response schemas."""

from __future__ import annotations

from pydantic import BaseModel, EmailStr, Field


class LoginRequest(BaseModel):
    """登录请求schema，支持"记住我"功能."""

    username: str = Field(min_length=1, max_length=255, description="用户名或邮箱")
    password: str = Field(min_length=1, max_length=128, description="密码")
    remember: bool = Field(default=False, description="记住我（30天自动登录）")


class PasswordResetRequest(BaseModel):
    email: EmailStr


class PasswordResetConfirm(BaseModel):
    token: str = Field(min_length=16, max_length=128)
    new_password: str = Field(min_length=8, max_length=128)


class PasswordResetDirect(BaseModel):
    """简化版密码重置：无邮件确认，直接输入2次新密码."""

    email: EmailStr
    new_password: str = Field(min_length=8, max_length=128, description="新密码")
    confirm_password: str = Field(min_length=8, max_length=128, description="确认新密码")


class TokenRefreshRequest(BaseModel):
    refresh_token: str = Field(min_length=16)


class Message(BaseModel):
    message: str
